<%@ page import="el.Book" %>
<%@ page import="java.sql.Array" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.HashMap" %><%--
  Created by IntelliJ IDEA.
  User: xiaofeng
  Date: 2025/5/19
  Time: 14:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    Book book = new Book();
    book.setName("昆虫总动员");

    book.setWriter(new String[]{"jack","tom"});

    ArrayList<String> readers = new ArrayList<>();
    readers.add("老韩");
    readers.add("老李");
    book.setReader(readers);

    HashMap<String, String> topics = new HashMap<>();
    topics.put("topic1", "这是我看过的最好的动画片");
    topics.put("topic2", "不错的电影~~");
    book.setTopics(topics);

    //把book 放入到request域对象
    request.setAttribute("bookkey",book);
%>
book对象:${bookkey}<br/>
book.name=:${bookkey.name}<br/>
book.writer=${bookkey.writer}<br/>
book.writer[0]=${bookkey.writer[0]}<br/>

book.readers=${bookkey.reader}<br/>
book.readers第2个=${bookkey.reader.get(0)}<br/>
book.readers第2个= ${bookkey.reader[1]}<br/>

book.topics=${bookkey.topics}<br/>
book.topics第一个评论=${bookkey.topics["topic1"]}
</body>
</html>
